﻿Public Class DocGiaDK_DAL
    Dim cn As New ConnectDB()
    Public Function dangky(ByVal p As DocGia_DTO) As Integer
        Dim Nparameter As Integer = 11
        Dim name As String() = New String(Nparameter - 1) {}
        Dim value As Object() = New Object(Nparameter - 1) {}

        name(0) = "@id"
        value(0) = ""

        name(1) = "@taikhoan"
        value(1) = p._taikhoan

        name(2) = "@matkhau"
        value(2) = p._matkhau

        name(3) = "@ten"
        value(3) = p._hoten

        name(4) = "@sdt"
        value(4) = p._sodienthoai

        name(5) = "@diachi"
        value(5) = p._diachi

        name(6) = "@phanquyen"
        value(6) = ""

        name(7) = "@gioitinh"
        value(7) = p._gioitinh

        name(8) = "@ghichu"
        value(8) = p._ghichu

        name(9) = "@ngaydk"
        value(9) = p._ngaydk

        name(10) = "@hinh"
        value(10) = p._hinh
        Return cn.updateData("dkdocgia", name, value, Nparameter)
    End Function

    Public Function load_DocGia() As DataTable
        Return cn.loadData("load_docgia")
    End Function

    Public Function CapNhap_DocGia(ByVal p As DocGia_DTO)
        Dim Nparameter As Integer = 9
        Dim name As String() = New String(Nparameter - 1) {}
        Dim value As Object() = New Object(Nparameter - 1) {}

        name(0) = "@taikhoan"
        value(0) = p._taikhoan

        name(1) = "@ten"
        value(1) = p._hoten

        name(2) = "@sdt"
        value(2) = p._sodienthoai

        name(3) = "@diachi"
        value(3) = p._diachi

        name(4) = "@gioitinh"
        value(4) = p._gioitinh

        name(5) = "@ghichu"
        value(5) = p._ghichu

        name(6) = "@id"
        value(6) = p._id

        name(7) = "@matkhau"
        value(7) = DBNull.Value

        name(8) = "@hinh"
        value(8) = p._hinh

        Return cn.updateData("capnhatdocgia", name, value, Nparameter)
    End Function
    Public Function xoaDocGia(ByVal p As DocGia_DTO)
        Dim Nparameter As Integer = 1
        Dim name As String() = New String(Nparameter - 1) {}
        Dim value As Object() = New Object(Nparameter - 1) {}

        name(0) = "@taikhoan"
        value(0) = p._taikhoan
        Return cn.updateData("xoadocgia", name, value, Nparameter)
    End Function
End Class
